<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*,
				 com.kylin.module.shop.orm.*,
                 com.kylin.common.util.*,
				 com.kylin.common.dict.orm.Dict,
                 com.kylin.common.paginate.DisplayPage,
			     com.kylin.module.user.orm.*"%>
<table width="100%">
	<tr>
		<td width="300" valign="top">
			<%@ include file="../_deco/manageLeft.jsp"%>
		</td>
		<td align="center" valign="top">
<%
////////////////////右侧 内容区  /////////////////////// start
	Company currCom = (Company)session.getAttribute(Constants.CURR_LANG_COMPANY);
%>

<table width="90%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td height="30" class="ms02">
			&nbsp;&nbsp;<bean:message key="company.54"/>
		</td>
	</tr>
	<tr>
		<td bgcolor="CDCDCD" height="1"></td>
	</tr>
</table>
<br>
<mytag:MyActionMsg />
<% 
    Product prod = (Product)request.getAttribute(Constants.KEY_REQUEST_RESULT);
    if(prod != null){
%>
<html:form action="/module/shop/company/manageProduct.do?CMD=update" enctype="multipart/form-data">
<input type="hidden" name="company" value="<%=currCom.getId()%>">
<input type="hidden" name="id" value="<%=prod.getId()%>">
<table width="86%" border="0" cellspacing="0" cellpadding="0">
	<tr align="left">
		<td width="80" height="30">
			<b><bean:message key="company.30"/>：</b>
		</td>
		<td><input type="text" name="name" value="<%=prod.getName() %>" />		</td>
	</tr>
	<tr align="left">
		<td height="30">
			<b><bean:message key="company.31"/>：</b>
		</td>
		<td>
              <%
    			  List maincatproduct = MemObjFactory.getDict(dict_catProducts,sessionLocale.toString());
                  StringBuffer sb1 = new StringBuffer();
                  StringBuffer sb2 = new StringBuffer();
                  for(int i=0;i<maincatproduct.size();i++){
                  	  Dict dict = (Dict)maincatproduct.get(i);
                      if(dict.getParent() == null){
                      	 if(sb1.length() > 1)
                      	     sb1.append(",");
                         sb1.append("\n  new SubSelectObj('").append(dict.getId()).append("','");
                         sb1.append("").append("','");
                         sb1.append(dict.getName()).append("')");
                      }else{
                      	 if(sb2.length() > 1)
                      	     sb2.append(",");
                         sb2.append("\n  new SubSelectObj('").append(dict.getId()).append("','");
                         sb2.append(dict.getParent().getId()).append("','");
                         sb2.append(dict.getName()).append("')");
                      }
                  }
                  
              %>
       
       <select name="catproduct" id="catproduct" onchange="checkCascadSelect(this)">
       <option>-- <bean:message key="company.77"/> --</option>
       </select>
       <script src="/script/kylin.js"></script>
       <script>
		var parentArray1= new Array(<%=sb1%>); 
		var subArray1= new Array(<%=sb2%>); 
		setCascadSelect(parentArray1,subArray1,document.getElementById("catproduct"));
        setSelectValue(document.getElementById("catproduct"),"<%=(prod.getCatproduct()!= null)?prod.getCatproduct().getId()+"":""%>");
       </script>       
		</td>
	</tr>
	<tr align="left">
		<td height="30">
			<b><bean:message key="base.63"/>：</b>
		</td>
		<td>
			<input name="quantity" type="text" value="<%=JspHelper.checkNull(prod.getQuantity())%>" size="10">
			<mytag:select name="unit" dictName="计量单位"/>
		</td>
	</tr>
	<tr align="left">
		<td height="30">
			<b><bean:message key="company.32"/>：</b>
		</td>
		<td>
			<input name="price" type="text" value="<%=JspHelper.checkNull(prod.getPrice())%>" size="10">
			<mytag:select name="currency" dictName="币种"/>
		</td>
	</tr>
	<tr align="left">
		<td height="30">
			<b><bean:message key="company.33"/>：</b>
		</td>
		<td>
			<textarea name="introduce" cols="50" rows="8"><%=prod.getIntroduce()%></textarea>
		</td>
	</tr>
	<tr align="left">
		<td height="30">
			<b><bean:message key="base.62"/>：</b>
		</td>
		<td><img src="/fileOutServlet?imgType=<%=Constants.IMG_PRODUCT%>&imgurl=<%=prod.getImgurl() %>" 
						    width="80" height="80">
			<input name="imgFile" type="file" size="40">
		</td>
	</tr>
	<tr align="center">
		<td height="50" colspan="2">
			<input type="submit" name="Submit" value="<bean:message key="base.69"/>">
		</td>
	</tr>
</table>
</html:form>
<%
    }else{
        out.println("未找到产品信息");
    }

%>
<%
////////////////////右侧 内容区  /////////////////////// end
%>		
		</td>
	</tr>
</table>
